<?php
    session_start();
    include 'query_mysql.php';
    $username=$_REQUEST['username'];
    $password=$_REQUEST['password'];
    echo $username.';'.$password;
    $conn=mysqli_connect('127.0.0.1','root','123456','tpp');
    $sql_txt="select * from tpp_user_info where username='$username' ";
    echo "<br>";
//    die($sql_txt);
//  只取1行数据
    $result=mysqli_query($conn,$sql_txt);
    var_dump($result);
    echo "<br>";
//    搞成一个数组
    $info=mysqli_fetch_array($result);
    var_dump($info);
    echo "<br>";
//    显示最后一行数据
    echo $info['user_id'];
    echo "<br>";
    echo '用户名：'.$info['username'];
    echo "<br>";
    echo '密码：'.$info['password'];
    echo "<br>";
    if ($username==$info['username']&&$password==$info['password']){
        echo "登录成功";
//        http_redirect("./logged_main_page.php");
        $_SESSION['is_logged']=1;
        $_SESSION['username']=$username;
        $qm=new query_mysql();
        $_SESSION['user_id']=$qm->query_sql("select * from tpp_user_info where username='$username'",'user_id');
        header("Location: http://localhost/logged_main_page.php");
    }
    else
        echo "<br>登录失败";
?>
<!--参考 https://www.cnblogs.com/stephenykk/p/3625310.html https://blog.csdn.net/qq_35718410/article/details/52450015 -->
<!--参考 https://www.cnblogs.com/linqingvoe/p/10909777.html -->
<!--?username=".$username."&&is_logged=1-->